#ifndef XMAIN_H
#define XMAIN_H

#include <string>


struct XHash
{
        std::string String;
        int Hash;

        XHash() {}

        XHash(std::string str)
        {
                String = str;
                Hash = _getHash(str.c_str());
        }

        XHash(const char* str)
        {
                String = str;
                Hash = _getHash(str);
        }

        int _getHash(const char* str)
        {
                int hash = 0;
                while (*str)
                {
                        hash = hash * 101  +  *str++;
                }

                return hash;
        }

        bool operator== (XHash hash)
        {
                if(hash.Hash == Hash)
                        return true;
                else
                        return false;
        }

        bool operator==(const char* str)
        {
                if(_getHash(str) == Hash)
                        return true;
                else
                        return false;
        }
};

struct XColor
{
        int R;
        int G;
        int B;
        int A;
       
        XColor() {}
        XColor(int r, int g, int b, int a) {R=r; G=g; B=b; A=a;}
};

struct XPosition
{
        float X;
        float Y;

        XPosition(){}
        XPosition(float x, float y){X=x; Y=y;}
};

struct XVector
{
        int X;
        int Y;

        XVector() {}
        XVector(int x, int y) {X=x; Y=y;}
};

struct XVertex
{
        float X;
        float Y;

        XVertex() {}
        XVertex(int x, int y) {X=x; Y=y;}
};

struct XVertexData
{
        XVertex Position;
        XVertex TextureCoord;
};

struct XRectangle
{
        float X;
        float Y;
        float W;
        float H;

        XRectangle(){}
        XRectangle(float x, float y, float w, float h) {X=x; Y=y; W=w; H=h;}

        bool operator==(XRectangle rect)
        {
                if(rect.X == X && rect.Y == Y && rect.W == W && rect.H == H)
                        return true;
                else
                        return false;
        }

        bool operator!=(XRectangle rect)
        {
                if(rect.X == X && rect.Y == Y && rect.W == W && rect.H == H)
                        return false;
                else
                        return true;
        }
};


#endif
